<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>查询详情</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="libs/dropzone.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/getQueryString.js"></script>
<script src="libs/js.cookie-2.1.0.min.js"></script>
<script src="libs/dropzone.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>档案管理</strong>
				</h2>
			</div>
			<div class="pull-right" className="input-group">
				<input className="form-control" type="text" id="a"
					placeholder="档案号或身份证号" />
				<!--搜索框-->
				<span className="input-group-btn">
					<button className="btn btn-default" onclick={this.submit}
						type="button" id="cha">
						<i className="fa fa-search">搜索</i>
					</button>
				</span>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">

			<div class="col-md-12">
				<ul class="nav nav-pills">
					<li><a href="index.html">首页</a></li>
					<li><a href="in.html">档案录入</a></li>
					<li><a href="query.html"> 查询</a></li>
					<li><a href="tongji.html"> 统计</a></li>
					<li class="active"><a href="#"> 档案上传</a></li>
					<li><a href="#">用户：<span id="text3"></span></a></li>
					<li><a id="exit"> 退出</a></li>

				</ul>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<hr />
			</div>
		</div>
	</div>
	<div class="container">


		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home"
				aria-controls="home" role="tab" data-toggle="tab">档案信息</a></li>
			<li role="presentation"><a href="#profile"
				aria-controls="profile" role="tab" data-toggle="tab">档案图片信息</a></li>
			<li role="presentation"><a href="#messages"
				aria-controls="messages" role="tab" data-toggle="tab">上传图片</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active" id="home">
				<div class="panel-body" id="list1"></div>
			</div>
			<div role="tabpanel" class="tab-pane" id="profile">
				<div class="panel-body" id="list2"></div>
			</div>
			<div role="tabpanel" class="tab-pane" id="messages">

				<form action="" method="post" enctype="multipart/form-data"
					id="form">
					<input type="file" value="上传信息" name="file"> <input
						type="submit" value="上传">
				</form>
				<form id="dropzone" action="" class="dropzone" method="post"></form>
			</div>
		</div>

	</div>





	<script id="template" type="text/x-handlebars-template">
{{#each item}}
<div class="panel panel-default col-md-3">
  <div class="panel-body">
   <dl>
     <dt>档案号</dt> <dd>{{archive_id}}</dd>
     <dt>身份证号</dt> <dd>{{identity}}</dd>
    <dt>姓名</dt> <dd>{{name}}</dd>
    <dt>性别</dt> <dd>{{gender}}</dd>
    <dt>出生日期</dt> <dd>{{birthday}}</dd>
    <dt>预退休日期</dt> <dd>{{date_retire1}}</dd>
    <dt>实际退休日期</dt> <dd>{{date_retire2}}</dd>
    <dt>特殊工种</dt> <dd>{{sp}}</dd>
    <dt>女管理岗位</dt> <dd>{{fc}}</dd>
    <dt>职称</dt> <dd>{{title}}</dd>
    <dt>工龄</dt> <dd>{{seniority}}</dd>
    
    <a href="update.html?id={{id}}">修改信息</a>
   </dl>
 </div>
</div>
{{/each}}
</script>
	<script id="template1" type="text/x-handlebars-template">
{{#each item}}
<div class="panel panel-default col-md-3">
  <div class="panel-body">
   <p>
         <img src="upload/{{archive_id}}/{{name}}" width="200" height="200" /></p>
     <a href="xiangqin.html?id={{id}}">详情<a>
 </div>
</div>
{{/each}}
</script>
	<script type="text/javascript">
		$(function() {
			$('#exit').click(function() {
				$.post('exit.action', {

				}, function(res, status) {
					if ('OK' == res) {
						alert('退出成功');
						window.location.href = 'login.html';
					} else if ('ERR' == res) {
						alert('账号或密码错误');

					}

				});
			});
			var id = getQueryString("id");

			$('#form').attr('action', id + '/upload.action');
			$.getJSON('chaxun3.action?id=' + id, function(res) {
				//console.log(res);
				var data = {
					'item' : res
				};
				var t = Handlebars.compile($('#template').html());
				$('#list1').html(t(data));
			});

			$.getJSON('queryfile.action?id=' + id, function(res) {
				console.log(res);
				var data = {
					'item' : res
				};
				var t = Handlebars.compile($('#template1').html());
				$('#list2').html(t(data));
			});

			$('#del').click(function() {

				$.post('del.action', {
					id : id
				}, function(res, status) {
					if ('OK' == res) {
						alert('删除成功');
						window.location.href = 'chaxun.html';
					} else if ('ERR' == res) {
						alert('账号或密码错误');
					}
				});
			});

			$('#myTabs a').click(function(e) {
				e.preventDefault()
				$(this).tab('show')
			})
			$.getJSON('user.action', function(res) {
				//console.log(res);  
				$('#text3').text(res.nickname);
			});
			$('#cha').click(function() {
				$.post('chaxun2.action', {
					a : $('#a').val()
				}, function(res, status) {
					if ('ERR1' == res) {
						alert('未查到档案');
					} else if ('ERR' == res) {
						alert('未定位到准确档案');
					} else {
						window.location.href = 'more.html?id=' + res;
					}
					;
				});
			});
		});
	</script>
	<script type="text/javascript">
		$(function() {
			$.backstretch("456.jpg");
		});
	</script>
	<script type="text/javascript">
		var id = getQueryString('id');
		Dropzone.options.dropzone = {
			url : id + '/upload.action',
			clickable : true,
			acceptedFiles : '.jpg',
			dictDefaultMessage : '拖放图片文件到此位置',
			dictInvalidFileType : '错误的文件类型',
			dictFileTooBig : '文件过大',
			dictResponseError : '与服务器连接失败',
			dictCancelUpload : '已取消',
			dictCanceluploadConfirmation : '确认取消上传'
		}
	</script>
</body>
</html>